#include<iostream>
#include<string>

template<typename T0,typename T1, typename T2>
struct S
{
    std::string id() { return "General"; }
};
// ����1��Լ��������������Ϊchar
template<typename T0, typename T1>
struct S<T0, T1, char>
{
    std::string id() { return "Specialization #1, third to char"; }
};
// ����2��Լ���ڶ���������������Ϊchar
template<typename T0>
struct S<T0, char, char>
{
    std::string id() { return "Specialization #2, the second and third to char"; }
};
// ����3��Լ����һ��������Ϊchar���ڶ�������������ͬ
template<typename T>
struct S<int, T, T>//�ƺ�������� �ػ���ģ���βκ�ͨ�ð��ܶ�Ӧ�ϣ�templateͷû̫���ϵ��
{
    std::string id() { return "Specialization #3, int, and, the second and third to T"; }
};

int run_main_eg4_4()
{
    using namespace std;
    cout << S<float, float, float>().id() << endl;
    cout << S<int, int, int>().id() << endl;
    cout << S<int, int, char>().id() << endl;
    cout << S<char, char, char>().id() << endl;
    //cout << S<int, char, char>().id() << endl; //error C2752: ��S<int,char,char>��: �������ר�û���ģ������б�ƥ��,message : �����ǡ�S<T0,char,char>��  ��    ��S<int,T,T>��
    // �������ִ����ܾ���Ҳ���п������õĵط����࿼�ǿ���
//General
//Specialization #3, int, and, the second and third to T
//Specialization #1, third to char
//Specialization #2, the second and third to char
    return 0;
}

int main() {
    return run_main_eg4_4();
}
